package com.iotek.bookstore.modle.dao.impl;

import com.iotek.bookstore.modle.entity.TitleOne;
import com.iotek.bookstore.util.RsCallBackHandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class TitleOneDaoImpl extends MyBookstoreDaoImpl<TitleOne>{

    /*
    * 查询所有的一级分类标题
    * */
    @Override
    public List<TitleOne> queryAll() {
        String sql="select * from titleone";
        this.query(sql, null, new RsCallBackHandler() {
            public void processRs(ResultSet rs) throws SQLException {
                while (rs.next()){
                    TitleOne titleOne=new TitleOne();
                    titleOne.setId(rs.getInt(1));
                    titleOne.setTitle(rs.getString(2));
                    list.add(titleOne);
                }
            }
        });
        return list;
    }
}
